/*
	Zeus Style
*/

ZEUS.STYLE = {
	// to judge an element has a class
	hasClass: function (elem, cls) {
		var regClass = new RegExp(' ' + cls + ' ');

		return regClass.test(' ' + elem.className + ' ');
	},

	// using plain javascript to add a class to an element
	addClassById: function (id, cls) {
		var elem = document.getElementById(id);
		if (!ZEUS.STYLE.hasClass(elem, cls)) {
			elem.className = cls;
		}
	},

	// using plain javascript to add a class to elements selected by tag
	addClassByTag: function (tag, cls) {
		var elems = document.getElementsByTagName(tag);
		for ( var i = 0; i < elems.length; i++) {
			if (!ZEUS.STYLE.hasClass(elems[i], cls)) {
				elems[i].className = cls;
			}
		}
	}
};

